<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output 
encoding="ISO-8859-1"
method="xml" indent="no" omit-xml-declaration="yes" />

	<xsl:template match="/palc">
		<palc>
			<id><xsl:value-of select="id" /></id>
			<idtienda>16</idtienda>
			<fecha class="sql-timestamp">
				<xsl:value-of select="date" />
			</fecha>
			<items>
				<xsl:for-each select="items/product">
					<articulo>
						<cantidad>
							<xsl:value-of select="amount" />
				 		</cantidad>
						<referencia>
							<xsl:value-of select="barcode" />
						</referencia>
					</articulo>
				</xsl:for-each>
			</items>
		</palc>
	</xsl:template>

	<xsl:template match="/envt">
		<envt>
			<date class="sql-timestamp">
				<xsl:value-of select="fechaalta" />
			</date>
			<items>
				<xsl:for-each select="items/envtitem">
					<product>
						<amount>
							<xsl:value-of select="cantidad" />
						</amount>
						<barcode>
							<xsl:value-of select="referencia" />
						</barcode>
					</product>
				</xsl:for-each>
			</items>
			<pendingItems>
				<xsl:for-each select="items/envtitem">
					<product>
						<amount>
							<xsl:value-of select="cantidad" />
						</amount>
						<barcode>
							<xsl:value-of select="referencia" />
						</barcode>
					</product>
				</xsl:for-each>
			</pendingItems>
		</envt>
	</xsl:template>

	<xsl:template match="/ofad">
		<ofad>
			<date class="sql-timestamp">
				<xsl:value-of select="fechaalta" />
			</date>
			<items>
				<xsl:for-each select="articulos/articulo">

					<product>
						<amount>0</amount>
						<barcode>
							<xsl:value-of select="referencia" />
						</barcode>
						<category>
							<xsl:value-of select="categoria" />
						</category>
						<color>
							<xsl:value-of select="color" />
						</color>
						<description>
							<xsl:value-of select="descripcion" />
						</description>
						<line>
							<xsl:value-of select="linea" />
						</line>
						<material>
							<xsl:value-of select="composicion" />
						</material>
						<measures>
							<xsl:value-of select="medidas" />
						</measures>
						<name>
							<xsl:value-of select="nombre" />
						</name>
						<orderStock>10</orderStock>
						<origin>
							<xsl:value-of select="origen" />
						</origin>
						<xsl:if test="preciooferta &gt; 0">
							<salePrice>
								<xsl:value-of select="preciooferta" />
							</salePrice>
						</xsl:if>
						<section>
							<xsl:value-of select="seccion" />
						</section>
						<stock>0</stock>
						<size>
							<xsl:value-of select="talle" />
						</size>
						<xsl:choose>
							<xsl:when test="'Hogar' = tipo">
								<type>Accessory</type>
							</xsl:when>
							<xsl:otherwise>
								<type>Apparel</type>
							</xsl:otherwise>
						</xsl:choose>
						<unitPrice>
							<xsl:value-of select="precio" />
						</unitPrice>
					</product>

				</xsl:for-each>
			</items>
		</ofad>
	</xsl:template>

</xsl:stylesheet>